package com.baishui.gateway.handler;

import com.baishui.gateway.exception.GateWayException;
import com.baishui.gateway.context.GateWayRouteContext;
import io.vertx.core.http.HttpServerResponse;
import io.vertx.ext.web.RoutingContext;
import org.springframework.stereotype.Component;

@Component
public class ServiceManageHandler extends AbstractHandler {

    @Override
    void handle(GateWayRouteContext context, RoutingContext routingContext) throws GateWayException {
        log.info("step {}", getClass().getName());
        try {
            String path = context.getPath();

//            PathDfaTree.getInstance().getPathNode()

            HttpServerResponse response = routingContext.response();
            response.putHeader("content-type", "text/plain")
                    .end("PathHandler !");
        } catch (Throwable throwable) {
            writeError(routingContext);
        }
    }
}
